int count = 0;
float lasttime = 0;
float currenttime = 0;

bool LastState=false;

void setup() {
  // Initialize the built-in LED pin as an output:
  pinMode(PC13, OUTPUT);
  // Initialize the built-in button (labeled BUT) as an input:
  pinMode(PB6, INPUT);
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  
  currenttime = millis();

  if (currenttime - lasttime <= 1000) {
    if ((digitalRead(PB6)) == HIGH and (LastState==false)) {
        LastState=true;
        count++;
    } 
    if((digitalRead(PB6)) == LOW){
      LastState=false;
      }
  }
  else {
    Serial.write(count);
    lasttime=currenttime;
    count = 0; 
  }

}
